home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Misc / AWNP / AWNP-Docs / Demos / DropZone.awebrx < prev    next >
Encoding:
Text File  |  1999-10-02  |  5.7 KB  |  262 lines

  1.  
  2. /*Drag and drop for AWeb
  3. $VER: DropZone 1.2 (30.9.99)
  4. William Parker  <bill@amitrix.com>
  5. Beta, do not distribute*/
  6.  
  7. trace('E')
  8. options results
  9.  
  10. if ~show('L','rexxsupport.library') then
  11. if ~addlib('rexxsupport.library',0,-30,0) then
  12. call exit(20)
  13.  
  14. if show('P','AWEBDROPZONE') then do
  15. address AWEBDROPZONE 'front'
  16. exit
  17. end
  18.  
  19. parse source . . called .
  20. c_dir=path(called)
  21. ports = show('P')
  22. parse var ports dummy 'AWEB.' portnr .
  23. address value 'AWEB.' || portnr
  24.  
  25. parse upper arg mode
  26. newwindow=0
  27. tofront=0
  28. child=0
  29. tempname=''
  30. call buildgui()
  31. call mainloop()
  32.  
  33. exit
  34.  
  35.  
  36. buildgui:
  37. if exists('env:aweb3') then envname='aweb3'
  38. else envname='aweb3se'
  39. if(open(env,'env:'envname'/dzwindow','R')) then do
  40. windows=readln(env)
  41. newwindow=readln(env)
  42. tofront=readln(env)
  43. child=readln(env)
  44. call close(env)
  45. parse var windows wl wt ww wh .
  46. windows= 'top' wt 'left' wl 'width' ww 'height' wh
  47. end
  48. else windows='tl width 100 height 100'
  49.  
  50. if Showlist('H', 'AWNPIPE') then res=open(ca,"awnpipe:dz/-2010/xc")
  51.     if res ~= 1 then do
  52. 'request nowait "DropZone Error"
  53.  "To use this program you need AWNPipe:*n
  54.         (Vers 2.10 or newer). *n
  55. Install AWeb 3.3SE from the AWeb install script*n
  56. or click on the CLICK ME icon in the AWeb drawer." "OK"'
  57.         exit 0
  58.     end
  59.  
  60. call topipe('"AWeb Drop Zone" sk v  m ii awebpath:aweb-II it DropZone ig app si 'windows' defaultgadgets  bf awebpath:docs/awebbg.iff')
  61. call topipe('button b 0 ro gt " " weiw 0 weih 0')
  62. call topipe('Menu gt "Project|Window|$@SSnapshot|$@UUnsnapshot|@DDrop Zone Docs|@AAbout|@QQuit"')
  63. call topipe('Menu gt "Settings|^%Open New Window|^%Screen to Front|^%Show Child Drawers"')
  64. call topipe('ARexx gt "AWEBDROPZONE|front|quit|close"')
  65. call topipe('open')
  66. abouttx='Drop Zone for AWeb 3.3*nVers 1.2*nAuthor William Parker*nGUI by AWNPipe:'
  67. noawebtx=' AWeb not Found *n Start AWeb and retry '
  68. if tofront~=0 then call topipe('id 3 tar 1 s 1')
  69. if child~=0 then call topipe('id 3 tar 2 s 1')
  70. if envname='aweb3se' then  topipe('id 3 tar 0 dis 1')
  71. else if newwindow~=0 then call topipe('id 3 tar 0 s 1')
  72. if left(mode,1)='I' then do
  73. in2=1
  74. call iconify()
  75. end
  76.  
  77. return
  78.  
  79. closegad:
  80. /*call setenv()*/
  81. return
  82.  
  83. setenv:
  84. if ~exists('env:'envname) then makdir('env:'envname)
  85. call writeln(ca,'id 0 read')
  86. windowr=readln(ca)
  87. parse var windowr wl wt ww wh .
  88. if (datatype(wt,N) &datatype(wl,N) &datatype(ww,N) & datatype(wh,N) ) then do
  89. windows= 'top' wt 'left' wl 'width' ww 'height' wh
  90. call open(env,'env:'envname'/dzwindow','W')
  91. call writeln(env,windowr)
  92. call writeln(env,newwindow)
  93. call writeln(env,tofront)
  94. call writeln(env,child)
  95. call close(env)
  96. end
  97. return(0)
  98.  
  99. setenvarc:
  100. call setenv()
  101. if ~exists('envarc:'envname) then makdir('envarc:'envname)
  102. address command 'copy env:'envname'/dzwindow envarc:'envname'/dzwindow >nil:'
  103. return
  104.  
  105. unsetenvarc:
  106. call setenv()
  107. if exists('envarc:'envname'/dzwindow') then delete('envarc:'envname'/dzwindow')
  108. if exists('env:'envname'/dzwindow') then delete('env:'envname'/dzwindow')
  109. return
  110.  
  111. menu:
  112. select
  113. when in2=0 then do
  114. if in3=0 then do
  115. if in4=0 then call setenvarc()
  116. if in4=1 then call unsetenvarc()
  117. end
  118. if in3=1 then do
  119. in2=c_dir'dropzone_doc.html'
  120. call app2()
  121. in2=0
  122. end
  123. if in3=2 then call showtx(500,abouttx)
  124. if in3=3 then do
  125. call closegad()
  126.  exit
  127. end
  128. end
  129. when in2=1 then do
  130. if in3=0 then newwindow=in5
  131. if in3=1 then tofront=in5
  132. if in3=2 then child=in5
  133. end
  134.  
  135. otherwise
  136. end
  137.  
  138. return
  139.  
  140.  
  141. showtx:
  142. call open(ptx,'awnpipe:/xc')
  143. call writeln(ptx,'db dg Information q cg ps 'screen' m a so si bf awebpath:docs/awebbg.iff')
  144. call writeln(ptx,'label gt "'arg(2)'"')
  145. call writeln(ptx,'open')
  146. call writeln(ptx,'tick 'arg(1))
  147. call close(ptx)
  148. return(0)
  149.  
  150.  
  151. mainloop:
  152. do while ~eof(ca)
  153. call topipe('con')
  154. in=readln(ca)
  155. parse var in in1 in2 in3 in4 in5 .
  156. select
  157. when in1='arexx' then call rxhst()
  158. when in1='menu' then call menu()
  159. when in1='gadget' then call gadget()
  160. when in1='close' then call closegad()
  161. when in1='app' then call app()
  162. when in1='key' then do
  163. if in2=223 then do
  164. in2=c_dir'dropzone_doc.html'
  165. call app2()
  166. in2=0
  167. end
  168. end
  169. when in1='iconify' then call iconify()
  170. otherwise
  171. end
  172.  
  173. end
  174. return
  175.  
  176. gadget:
  177. if in2=1 then newwindow= in3
  178. if in2=2 then tofront= in3
  179. return
  180.  
  181. app:
  182. parse var in . in2
  183. in2=strip(in2)
  184. app2:
  185. ports = show('P')
  186. parse var ports dummy 'AWEB.' portnr .
  187. address value 'AWEB.' || portnr
  188. if portnr='' then do
  189. call showtx(500,noawebtx)
  190. return
  191. end
  192. 'GET ACTIVEPORT '
  193. awebhost=result
  194. address value awebhost
  195.  
  196. if (right(in2,1)=':' | right(in2,1)='/') then call showdir()
  197.  
  198. if newwindow~=0 then 'new  "file:///'in2'"'
  199. else 'open reload "file:///'in2'"'
  200. if tofront~=0 then do
  201. if newwindow=0 then 'window tofront'
  202. 'screentofront'
  203. end
  204. if show('P','AWEBTOOLBAR') then address AWEBTOOLBAR 'front'
  205. if tempname~='' then do
  206. 'wait "file:///'in2'"'
  207. call delete(tempname)
  208. tempname=''
  209. end
  210. return
  211.  
  212. iconify:
  213. if in2=1 then call topipe('id 0 s 32')
  214. else  do
  215. call topipe('id 0 s 64')
  216. end
  217. return
  218.  
  219. showdir:
  220. tempname ='t:dzone'time('s')
  221. if child~=0 then all='all'
  222. else all=''
  223. address command 'echo >'tempname' "<html><head><title>Directory of 'in2' </title></head>"'
  224. address command 'echo >>'tempname' "<body><h1>Directory of' in2 '</h1><pre>"'
  225. address command 'list >>'tempname' "'in2'" pat ~(#?.info) files 'all' lformat "<a href=*"file:///%p%n*">%p%n</a> <br>"'
  226. in2=tempname
  227. return()
  228.  
  229. topipe:
  230. parse arg out
  231. call writeln(ca,out)
  232. res=readln(ca)
  233. parse var res res1 res2 res3
  234. if res1='ok' then return(res2)
  235. say 'error from: 'out
  236. say '  responce: ' in
  237. exit
  238.  
  239. path:
  240. parse arg pathf
  241. dir_pos = max(lastpos('/',pathf),lastpos(':',pathf))
  242. if dir_pos > 0 then return(left(pathf,dir_pos))
  243. else return('')
  244.  
  245. rxhst:
  246.  
  247. rxcmd=readch(ca,in3)
  248. if in2>1 then call writeln(ca,"rc 10")
  249. if in2=0 then do
  250. call topipe('rc 0 result "Window brought to front"')
  251. tofront=1
  252. end
  253. if in2=1 then do
  254. call topipe(ca,'rc 0 result "DropZone exiting"')
  255. end
  256.  
  257. if tofront=1 then do
  258. call topipe('id 0 s 67')
  259. tofront=0
  260. end
  261. return
  262.